While the push operation successfully added data and incremented the top pointer, the pop operation performs the inverse: it removes the last element added, strictly adhering to the FILO principle. The primary boundary check required for pop is preventing Underflow (popping from an empty stack).

  • Boundary Check: Verify the stack is not empty using the isEmpty check (top == -1). If empty, Stack Underflow occurs.
  • Retrieve Value: If safe, the element currently pointed to by top is retrieved. This element (e.g., 40 from Conceptual_Stack_Data) is the value being returned.
  • Decrement Pointer: The top index must be decremented *after* retrieval. This logically removes the element from the accessible stack space, even if the data remains in the underlying array.